package br.com.automed.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

import br.com.automed.entity.TipoTelefone;

@FacesConverter(forClass=TipoTelefone.class)
public class TipoTelefoneConverter implements Converter{

	public Object getAsObject(FacesContext arg0, UIComponent arg1, String value) {
		String[] values = value.split(";");
		TipoTelefone tipo = new TipoTelefone(values[0], values[1]);
		
		return tipo;
	}

	public String getAsString(FacesContext arg0, UIComponent arg1, Object value) {

		return value.toString();
	}

}
